var url = require('url');
var template = require('templateConfig');
var main = require('main');
var form = require('form');
var module= require('module');

//模板配置
var tplArr = [];
var comisTpl =require('raw!../template/comission-tab.txt');   
tplArr['comis'] = template.compile(comisTpl.replace(/^\s*|\s*$/g, "")); 
 
function Comis(){
    _this = this;
    this.main = function(){
        main.event(this,'tap','i-click'); 
        this.init();
    }     
    this.getContent =function(){
    	var data = {
    		tType: 'content',
            select:module.getModule({"fun":'om-change="selectFun"',"list":[{"name":"佣金排行榜","value":"1"},{"name":"佣金排行榜2","value":"2"}],"selected":"1"},'baseSelect')
    	}
    	$(".content").html(tplArr['comis'](data));
    }
    this.getTab = function(){
        var data = {
            tType: 'table',
            title: "8月佣金排行榜",
            tabList:[{
                name: "lily",
                store: "福建中路店",
                money: "1,230",
            },{
                name: "lily",
                store: "福建中路店",
                money: "230",
            }]
        }
        $(".month-comission").html(tplArr['comis'](data));
    }
    this.getTotal = function(){
        var data = {
            tType: 'table',
            title: "佣金总排行榜",
            tabList:[{
                name: "lily",
                store: "福建中路店",
                money: "1,230",
            },{
                name: "lily",
                store: "福建中路店",
                money: "230",
            },{
                name: "lily",
                store: "福建中路店",
                money: "1,230",
            }]
        }
        $(".total-comission").html(tplArr['comis'](data));
    }
    //下拉筛选
    this.selectFun = function(ths){
        alert(ths.val());
    }
    this.init= function(){ 
        this.getContent();
        this.getTab();
        this.getTotal();     
    }
    return this.main();
};

var comis = new Comis();